<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:cc="http://java.sun.com/jsf/composite/controls"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/template/appTemplate.xhtml">
	<ui:define name="topMenu">
		<cc:topMenu activeIndex="5"/>
	</ui:define>
	<ui:define name="left">
	<ul type="circle">
		<li>
		<a href="/admin/param.jsf">系统参数设置</a>
		</li>
		<li>
		<a href="/admin/code.jsf">基础数据设置</a>
		</li>
		<li>
		<a href="/admin/i18n.jsf">国际化设置</a>
		</li>
		<li>
		<a href="/admin/cache.jsf">缓存管理</a>
		</li>
	</ul>
	</ui:define>
	<ui:define name="center">
	<h:form id="dataTableForm">
	<cc:currentFunction value="系统参数设置"/>
		<p:menubar>
	        <p:menuitem value="查看" update=":dataTableForm:detailsPanel" oncomplete="dialog.show()"
	        	 icon="ui-icon-contact"/>
	        <p:menuitem value="编辑" action="#{sysParamCtrl.edit}" update=":dataTableForm:detailsPanelEdit" 
	        	oncomplete="dialogEdit.show()" icon="ui-icon-pencil"/>
	        <p:menuitem value="新增" action="#{sysParamCtrl.create}" update=":dataTableForm:detailsPanelEdit" 
	        	oncomplete="dialogEdit.show()" icon="ui-icon-document"/>
	        <p:menuitem value="删除" onclick="confirmation.show()" icon="ui-icon-close"/>
	    </p:menubar>
	    <p:growl id="messages" /> 
	    <p:dataTable id="dataTable" var="var" value="#{sysParamCtrl.listModel}" rowKey="#{var.paramId}"
                 paginator="true" rows="10"  lazy="true" selection="#{sysParamCtrl.selectedRecord}" 
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15" paginatorPosition="bottom">  
        <p:column selectionMode="single" style="width:18px" />  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="序列号" />  
            </f:facet>  
            <h:outputText value="#{var.paramId}" />  
        </p:column> 
  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="名称" />  
            </f:facet>  
            <h:outputText value="#{var.name}" />  
        </p:column>  
  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="说明" />  
            </f:facet>  
            <h:outputText value="#{var.desp}" />  
        </p:column>  
  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="参数值" />  
            </f:facet>  
            <h:outputText value="#{var.paramValue}" />  
        </p:column>  
  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="状态" />  
            </f:facet>  
            <h:outputText value="#{var.status}" />  
        </p:column>  
    </p:dataTable> 
    
    <p:dialog header="详细信息" widgetVar="dialog" resizable="false"
              width="400" height="200">  
  
        <h:panelGrid id="detailsPanel" columns="2" cellpadding="4"> 
            <h:outputText value="名称:" />  
            <h:outputText value="#{sysParamCtrl.selectedRecord.name}"/>  
            <h:outputText value="说明:" />  
            <h:outputText value="#{sysParamCtrl.selectedRecord.desp}"/>  
            <h:outputText value="参数值:" />  
            <h:outputText value="#{sysParamCtrl.selectedRecord.paramValue}"/> 
            <h:outputText value="状态:" />  
            <h:outputText value="#{sysParamCtrl.selectedRecord.status}"/> 
        </h:panelGrid>  
    </p:dialog>
    
    <p:dialog header="编辑" widgetVar="dialogEdit" resizable="false"
              width="400" height="200">  
  		
        <h:panelGrid id="detailsPanelEdit" columns="2" cellpadding="4"> 
            <h:outputText value="名称:" />  
            <h:inputText value="#{sysParamCtrl.editRecord.name}" size="40"/>  
            <h:outputText value="说明:" />  
            <h:inputText value="#{sysParamCtrl.editRecord.desp}" size="40"/>  
            <h:outputText value="参数值:" /> 
            <h:inputText value="#{sysParamCtrl.editRecord.paramValue}" size="40"/>  
            <h:outputText value="状态:" />  
            <h:selectOneRadio value="#{sysParamCtrl.editRecord.status}">
            	<f:selectItem itemValue="Y" itemLabel="Active"/>
            	<f:selectItem itemValue="N" itemLabel="Inactive"/>
            </h:selectOneRadio>
            <h:outputText value="" />
              <p:commandButton value="保存" action="#{sysParamCtrl.saveEdit}" update=":dataTableForm:messages,dataTable" oncomplete="dialogEdit.hide()" icon="ui-icon-disk"/>
        </h:panelGrid>  
    </p:dialog>
	         
    </h:form>
	</ui:define>
	<ui:define name="other">
	 <p:confirmDialog id="confirmDialog" message="你要删除该条记录吗?"  
                header="删除记录" severity="alert" widgetVar="confirmation" width="300">  
		        <p:commandButton id="confirm" value="确定" update=":dataTableForm:messages,:dataTableForm:dataTable" oncomplete="confirmation.hide()"  
		                    actionListener="#{sysParamCtrl.deleteSelected}" />  
		        <p:commandButton id="decline" value="取消" onclick="confirmation.hide()" type="button" />   
		    </p:confirmDialog>
	</ui:define>
</ui:composition>
</html>